﻿using System;
using System.Collections.Generic;
using Acaweb.Data.Contracts;
using Acaweb.Model.Entities;
using Spring.Transaction.Interceptor;
using System.Linq;

namespace Acaweb.Data.Dao.NHibernate
{
    public class DepartamentosDao : HibernateDao<Departamentos,int>, IDepartementosDao
    {
        [Transaction(ReadOnly = true)]
        public IList<Departamentos> GetAll()
        {
            return GetAll<Departamentos>();
        }

        [Transaction(ReadOnly = true)]
        public IList<Departamentos> GetByPais(int Codigo)
        {
            return this.Session.QueryOver<Departamentos>().Where(t => t.CodigoPais == Codigo).List();
        }

        [Transaction(ReadOnly = true)]
        public Departamentos GetByNombre(string Nombre)
        {
            return this.Session.QueryOver<Departamentos>().Where(t => t.Nombre == Nombre).List().First();
        }
    }
}
